package com.glsc.ngateway.common.base.domain.mysql.opmanage.report.basicsettings;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Entity
@Table(name = "t_asset_pool_list")
@JsonInclude(JsonInclude.Include.NON_NULL)
@IdClass(value = AssetPoolList.PK.class)
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class AssetPoolList {

    static class PK implements Serializable {
        private Long assetPoolId;
        private Long assetId;

        public Long getAssetPoolId() {
            return assetPoolId;
        }

        public Long getAssetId() {
            return assetId;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof PK)) return false;
            PK pk = (PK) o;
            return getAssetPoolId().equals(pk.getAssetId()) &&
                    getAssetPoolId().equals(pk.getAssetId());
        }

        @Override
        public int hashCode() {
            return Objects.hash(getAssetPoolId(), getAssetId());
        }
    }

    @Id
    @Column(name="fl_assetpoolid")
    private Long assetPoolId;

    @Id
    @Column(name="fl_assetid")
    private Long assetId;

    public AssetPoolList() {
    }

    public AssetPoolList(Long assetPoolId, Long assetId) {
        this.assetPoolId = assetPoolId;
        this.assetId = assetId;
    }

    public void setAssetPoolId(Long assetPoolId) {
        this.assetPoolId = assetPoolId;
    }

    public Long getAssetPoolId() {
        return assetPoolId;
    }

    public void setAssetId(Long assetId) {
        this.assetId = assetId;
    }

    public Long getAssetId() {
        return assetId;
    }
}
